package com.gitee.fastmybatis.core.support;

import com.gitee.fastmybatis.core.query.LambdaQuery;
import com.gitee.fastmybatis.core.query.Query;
import com.gitee.fastmybatis.core.query.TenantQuery;

/**
 * 快捷方式创建Query
 * @author thc
 */
public class Q {

    /**
     * 创建LambdaQuery
     * <pre>
     * {@literal
     * Query query = Q.create(TUser.class)
     *     .eq(TUser::getId, 1)
     *     .ge(TUser::getId, 1)
     *     .in(TUser::getId, Arrays.asList(1,2))
     *     .between(TUser::getId, 1, 2)
     *     .sql("id=1");
     * List<TUser> list = mapper.list(query);
     * }
     * </pre>
     * @param clazz 实体类class
     * @return 返回LambdaQuery实例
     * @param <T> 实体类
     */
    public static <T> LambdaQuery<T> create(Class<T> clazz) {
        return new LambdaQuery<>();
    }

    /**
     * 创建Query
     * @return 返回Query实例
     */
    public static Query create() {
        return new Query();
    }

    /**
     * 创建多租户Query
     * @return 返回Query实例
     */
    public static TenantQuery createTenant() {
        return new TenantQuery();
    }
}
